<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>写文章 -后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="/admin/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/admin/css/style.css">
    <link rel="stylesheet" type="text/css" href="/admin/css/font-awesome.min.css">
    <link rel="apple-touch-icon-precomposed" href="/admin/images/icon/icon.png">
    <link rel="shortcut icon" href="/admin/images/icon/favicon.ico">
    <script src="/admin/js/jquery-2.1.4.min.js"></script>
    <script src="/admin/js/jquery.form.js"></script>
    <script src="/ckeditor4.10/ckeditor.js"></script>
</head>

<body class="user-select" style="margin: 0px;padding: 0px;">
<div>
    <ul class="breadcrumb" style="margin: 0px;">
        <li>文章管理</li>
        <li>文章添加</li>
    </ul>
</div>
<br/>
<div class="row">
    <div align="center" style="color: red">${(info)!}</div>
    <form id="fm1" action="/back/article/add" method="post" class="add-article-form">

        <div class="col-md-9">

            <div class="form-group">
                <label for="article-title" class="sr-only">标题</label>
                <input type="text" id="article-title" name="articleTitle" class="form-control" placeholder="在此处输入标题"
                       required autofocus autocomplete="off">
            </div>
            <div class="form-group">
                <label for="article-content" class="sr-only">内容</label>
                <textarea name="articleContent" class="ckeditor" style="height: 350px;"></textarea>
            </div>

        </div>
        <div class="col-md-3">

            <div class="add-article-box">
                <h2 class="add-article-box-title"><span>栏目</span></h2>
                <div class="add-article-box-content">
                    <ul class="category-list">
                    <#list (cateList)! as cate>
                        <li>
                            <label>
                                <input name="categoryId" type="radio" value="${(cate.id)!}">
                                ${(cate.categoryName)!} <#--<em class="hidden-md">( 栏目ID: <span>${(cate.id)!}</span> )</em>-->
                            </label>
                        </li>
                    </#list>
                    </ul>
                </div>
            </div>

            <div class="add-article-box">
                <h2 class="add-article-box-title"><span>标题图片</span></h2>
                <div class="add-article-box-content">
                    <input type="file" class="form-control" placeholder="点击按钮选择图片" onchange="uploadImg()" name="upload"
                           autocomplete="off">
                    <img src="http://localhost:8080/file/upload/fj.jpg" id="fileImg" height="100" width="338"/>
                    <input type="hidden" name="articleImg" id="articleImg"
                           value="http://localhost:8080/file/upload/fj.jpg">
                </div>

            </div>
            <div class="add-article-box">
                <h2 class="add-article-box-title"><span>发布</span></h2>
                <div class="add-article-box-content">
                    <p><label>站长推荐：</label><input type="radio" name="articleRecom" value="1" checked/>是 <input
                            type="radio" name="articleRecom" value="0"/>否</p>
                    <p><label>是否发布：</label><input type="radio" name="articleMark" value="1" checked/>是 <input
                            type="radio" name="articleMark" value="0"/>否</p>
                <#--<p><label>发布于：</label><span class="article-time-display"><input style="border: none;" type="datetime" name="time" value="2016-01-09 17:29:37" /></span></p>-->
                </div>
                <div class="add-article-box-footer">
                    <button class="btn btn-primary" type="submit" name="submit">发布</button>
                </div>
            </div>
        </div>
    </form>
</div>

<script src="/admin/js/bootstrap.min.js"></script>
<script src="/admin/js/admin-scripts.js"></script>
<script>
    function uploadImg() {
        var options = {
            url: '/back/article/upload',
            type: 'post',
            success: function (data) {
                $("#fileImg").removeAttr("src");
                $("#fileImg").attr("src", data);
                $("#articleImg").val(data);
            }
        }
        $("#fm1").ajaxSubmit(options);
    }
</script>
</body>
</html>
